Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copied apy calculation code from solend-lite to sdk (calculation was broken) #70

Merged

Conversation

silostack
Copy link

the calculated supply apy was way off from what's shown on lite.solend.fi and solend.fi. copied the code over from the lite.solend.fi code to the sdk.

Copy link

vercel bot commented Mar 15, 2024

Someone is attempting to deploy a commit to the Solend Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

netlify bot commented Mar 15, 2024

Deploy Preview for papaya-travesseiro-c75216 canceled.

Name Link
🔨 Latest commit 4460b23
🔍 Latest deploy log https://app.netlify.com/sites/papaya-travesseiro-c75216/deploys/65faa7e81f11f80008bcd56d

@nope-finance
Copy link
Member

hm so i was looking at the code and i think issue was also that the rates calcs are duplicated in
solend-sdk/src/core/utils/rates.ts i think it would be preferable to just remove these functions or have them reference the functions in rates.ts instead of copy pasting the logic

@silostack
Copy link
Author

hm so i was looking at the code and i think issue was also that the rates calcs are duplicated in solend-sdk/src/core/utils/rates.ts i think it would be preferable to just remove these functions or have them reference the functions in rates.ts instead of copy pasting the logic

Yea I was in a hurry to get things fixed so copy/pasted lol. I updated the code and fixed in a couple other places in the same file as well. There's still a lot more code that's duped and can get cleaned up in that file...


return currentUtilization;
}

private calculateBorrowAPR(reserve: ParsedReserve) {
private calculateBorrowAPR = (reserve: ParsedReserve) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this as caclulateUtilizationRatio are also in that other file

Copy link
Member

@nope-finance nope-finance Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, i'd just edit it but i think i can't edit a fork

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed that method along with the caclulateUtilizationRatio from the reserve.ts file as they're no longer used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think possible one might want to grab the utilization ratio but yeh seems fine now ill merge this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually kinda same with calculateBorrowAPR one probably would want it

@nope-finance nope-finance merged commit 2f433e3 into solendprotocol:master Mar 20, 2024
6 of 7 checks passed
@silostack silostack deleted the fix/supply-apy-calculation branch March 26, 2024 20:14
0xodia pushed a commit that referenced this pull request Sep 9, 2024
copied apy calculation code from solend-lite to sdk (calculation was broken)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants